package com.example.shixunandjavagotoyangchen.BoosYang.Day005;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.bumptech.glide.Glide;
import com.example.modelviewpresenter.View.BasterFragment;
import com.example.shixunandjavagotoyangchen.Activity.CeShiZiYouActivity;
import com.example.shixunandjavagotoyangchen.Activity.MainActivity;
import com.example.shixunandjavagotoyangchen.BoosYang.Day001.Day00101.MeetDay00101XiaoxiActivity;
import com.example.shixunandjavagotoyangchen.BoosYang.Day005.SwimErweima.GoatActivity;
import com.example.shixunandjavagotoyangchen.R;
import com.umeng.socialize.ShareAction;
import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.UMShareListener;
import com.umeng.socialize.bean.SHARE_MEDIA;
import com.umeng.socialize.media.UMWeb;


public class BlankFragmentDay005 extends BasterFragment {


    private ImageView touxiang;
    private ImageView SwimShezhi;
    private ImageView SwimErweima;
    private ImageView SwimXiaoxi;
    private ImageView SwimFenxiang;

    @Override
    public int BandLayout() {
        return R.layout.fragment_blank_fragment_day005;
    }

    @Override
    public void initView() {


        touxiang = (ImageView) findViewById(R.id.touxiang);
        Glide.with(getActivity()).load(R.mipmap.imger_touxiang).circleCrop().into(touxiang);

        SwimShezhi = (ImageView) findViewById(R.id.Swim_Shezhi);
        SwimErweima = (ImageView) findViewById(R.id.Swim_Erweima);
        SwimXiaoxi = (ImageView) findViewById(R.id.Swim_Xiaoxi);
        SwimFenxiang = (ImageView) findViewById(R.id.Swim_Fenxiang);
    }

    @Override
    public void initDate() {

        //----------------------------------设置-------------------------------------------
        SwimShezhi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance()
                        .build("/Swim/Shezhi")
                        .withString("Shezhi","设置")
                        .navigation();
            }
        });

        //----------------------------------二维码-------------------------------------------
        SwimErweima.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent fenxiang = new Intent(getActivity(), GoatActivity.class);
                startActivity(fenxiang);
            }
        });


        //----------------------------------消息-------------------------------------------
        SwimXiaoxi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(getActivity(), MeetDay00101XiaoxiActivity.class);
                startActivity(intent);
            }
        });


        //----------------------------------分享-------------------------------------------
        SwimFenxiang.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new ShareAction(getActivity()).withMedia(new UMWeb("https://www.umeng.com/")).setDisplayList(SHARE_MEDIA.SINA,SHARE_MEDIA.QQ,SHARE_MEDIA.QZONE,SHARE_MEDIA.WEIXIN)
                        .setCallback(new UMShareListener() {
                            @Override
                            public void onStart(SHARE_MEDIA share_media) {

                            }

                            @Override
                            public void onResult(SHARE_MEDIA share_media) {

                            }

                            @Override
                            public void onError(SHARE_MEDIA share_media, Throwable throwable) {

                            }

                            @Override
                            public void onCancel(SHARE_MEDIA share_media) {

                            }
                        }).open();
            }
        });

    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data){
        super.onActivityResult(requestCode, resultCode, data);
        UMShareAPI.get(getActivity()).onActivityResult(requestCode, resultCode, data);
    }

}
